package com.xl.minyue.tc2.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xl.minyue.tc2.dao.ReportFormDao;
import com.xl.minyue.tc2.pojo.PointInfo;
import com.xl.minyue.tc2.pojo.TagDataX3;
import com.xl.minyue.tc2.pojo.TagInfo;
import com.xl.minyue.tc2.pojo.User;
import com.xl.minyue.tc2.service.ReportFormServiceImpl;
import com.xl.minyue.tc2.until.DingDing;
import com.xl.minyue.tc2.until.UntilJNative;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
public class TestX3Controller3 {
    /*private ReportFormDao dao;
    private ReportFormServiceImpl reportFormService;*/



/*

    public HashMap<String, Object> showReportData(HttpServletRequest req){
        System.out.println(new Date()+"<-------------开始时间");
        System.out.println(req.getRequestURL()+"<--------showReportData------url");
        HashMap<String, Object> resMap = new HashMap<>();
        SimpleDateFormat d1 = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat d2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat d3 = new SimpleDateFormat("mm");
        SimpleDateFormat d4 = new SimpleDateFormat("HH");
        String format = d1.format(new Date());
        try {
            String data = IOUtils.toString(req.getInputStream());
            JSONObject jsonObject = JSON.parseObject(data);
            //获取参数
            //展示的点的列表
            JSONArray jsonArray = jsonObject.getJSONArray("codeList");
            //日期
            String date = jsonObject.getString("date");
            if (date==null || date.equals("")){
                date=format;
            }
            System.out.println(date+"<--------展示数据的日期"+jsonArray);
            List<Object> list = new ArrayList<>();
            if (jsonArray.size()>0){
                for (int i = 0; i <jsonArray.size() ; i++) {
                    String code = jsonArray.get(i).toString();
                    Map map2 = new HashMap<>();
                    List<String> list2 = new ArrayList<>();
                    String name=null;
                    List<TagInfo> infoList = reportFormService.showDataByDateAndPoint2(code, date);
                    for (int j = 0; j <infoList.size(); j++) {
                        TagInfo t = infoList.get(j);
                        if(j==0){
                            String colltime = t.getColltime();
                            int minitue = Integer.parseInt(d3.format(d2.parse(colltime)));
                            int hour= Integer.parseInt(d4.format(d2.parse(colltime)));
                            int floor = (int) Math.floor(minitue / 5);
                            int num5=hour*12+floor;
                            for (int k = 0; k < num5; k++) {
                                list2.add("0");
                            }
                        }
                        list2.add(t.getTagvalue());
                        if (name==null){
                            name=t.getTagname2();
                        }

                     if(j==(infoList.size()-1)){
                            String colltime = t.getColltime();
                            int minitue = Integer.parseInt(d3.format(d2.parse(colltime)));
                            int hour= Integer.parseInt(d4.format(d2.parse(colltime)));
                            int floor = (int) Math.floor(minitue / 5);
                            int num6=hour*12+floor+1;
                            for (int k =num6; k < 289; k++) {
                                    list2.add("0");
                            }

                        }
                    }

                    if(name==null){
                        map2.put("tagName","");
                    }else{
                        map2.put("tagName",name);
                    }
                    map2.put("tagCode",code);
                    map2.put("tagVlue",list2);
                    list.add(map2);
                }
            }
            resMap.put("data",list);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (Exception e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap)+"---------实时数据曲线------");
        System.out.println(new Date()+"<-------------结束时间");
        return resMap;
    }

*/












    //暂时都是无用的接口

/*

    //字符串类型日期转换为long类型的毫秒值
    public long getTime(String date) throws ParseException {
        SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date parse = dateFormat3.parse(date);
        return  parse.getTime();
    }



    @RequestMapping("/api/receiveDatax3.do")
    @ResponseBody
    public void  receiveDataFromX3(HttpServletRequest req, HttpServletResponse res){
        //运用请求头传递数据
        System.out.println("获取请求头中传递的数据data!!!!!");
        Enumeration<String> headerNames = req.getHeaderNames();
        String trans_data=null;
        while(headerNames.hasMoreElements()){
            String name = headerNames.nextElement();
            System.out.println(name+"<---------name");
            if(name.equals("data")){
                trans_data = req.getHeader(name);
               break;

            }

        }
        System.out.println(trans_data+"<--------value,传递的数据!!!!!!!!!");
        if(trans_data !=null){
            JSONObject transData = JSON.parseObject(trans_data);
            JSONArray dataJSONArray = transData.getJSONArray("data");

            if(dataJSONArray.size()>0){
                System.out.println("保存接收到的数据!!!!!!!!!!!!");
            }
        }

    }


    //获取所有的副分类
    @RequestMapping("/api/getKind1.do")
    @ResponseBody
    public HashMap<String, Object> getKind_1(HttpServletRequest req){
        System.out.println(req.getRequestURL()+"<---getKind_1----url");
        HashMap<String, Object> resMap = new HashMap<>();
        ArrayList<String> list = reportFormService.getKind_1();
        if (list.size()>0){
            resMap.put("data",list);
            resMap.put("code","0");
            resMap.put("msg","请求成功");

        }else{
            resMap.put("data","");

            resMap.put("code","1");
            resMap.put("msg","请求失败,数据为空");
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }

    //获取所有的主要分类
    @RequestMapping("/api/getKind2.do")
    @ResponseBody
    public HashMap<String, Object> getKind_2(HttpServletRequest req){
        System.out.println(req.getRequestURL()+"<-----getKind_2--url");
        HashMap<String, Object> resMap = new HashMap<>();
        ArrayList<String> list = reportFormService.getKind_2();
        if(list.size()>0){
            resMap.put("data",list);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        }else{
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,数据为空");
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }



    //筛选查询-----------没问题=============暂时不用
    @RequestMapping("/api/selectTag.do")
    @ResponseBody
    public HashMap<String, Object> selectTagsByCodeOrName(HttpServletRequest req,HttpServletResponse res){
        System.out.println(req.getRequestURL()+"<---selectTagsByCodeOrName------url");
        HashMap<String, Object> resMap = new HashMap<>();
        try {
            String data = IOUtils.toString(req.getInputStream());
            Map reqMap = JSON.parseObject(data, Map.class);
            System.out.println("json转换的map:"+reqMap.toString());
            //获取参数
            String name = reqMap.get("name").toString();
            String code = reqMap.get("code").toString();
            String kind1 = reqMap.get("kind1").toString();
            String kind2 = reqMap.get("kind2").toString();
            System.out.println(code+"<-----code,"+name+"<------------name");
            List<PointInfo> infoList = reportFormService.selectTagsByCodeOrName(name, code,kind1,kind2);
            resMap.put("data",infoList);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (Exception e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }



    //根据分类查询点信息-----------------暂时不需要
    @RequestMapping("/api/findPointInfoByKind.do")
    @ResponseBody
    public HashMap<String, Object> findPointInfoByKind(HttpServletRequest req){
        System.out.println(req.getRequestURL()+"<-----findPointInfoByKind-------url");
        HashMap<String, Object> resMap = new HashMap<>();
        try {
            String data = IOUtils.toString(req.getInputStream());
            JSONObject jsonObject = JSON.parseObject(data);
            //获取的参数
            String kind1 = jsonObject.get("kind1").toString();//实时 日报   月报
            //主分类 小指标(7),小指标(8)
            String kind2 = jsonObject.get("kind2").toString();
            List<PointInfo> info = reportFormService.checkPointInfoByKind(kind1, kind2);
            System.out.println(info.size()+"<-------------长度");
            for (PointInfo p : info) {
                System.out.println(p.getPointname()+"<------------name,"+p.getId()+"<--------Id");
            }
            resMap.put("data",info);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (IOException e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }



    //查询点信息
    @RequestMapping("/api/findPointInfo2.do")
    @ResponseBody
    public HashMap<String, Object> test2(HttpServletRequest req){
        System.out.println(req.getRequestURL()+"<---findPointInfo------url");
        HashMap<String, Object> resMap = new HashMap<>();
        List<PointInfo> info = dao.findAllPointsInfo();
        System.out.println(info.size()+"<-------------长度");
        for (PointInfo p : info) {
            System.out.println(p.getPointname()+"<------------name,"+p.getId()+"<--------Id");
        }
        if(info.size()>0){
            resMap.put("data",info);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        }else{
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }



    //签名
    @RequestMapping("/api/getSignature.do")
    @ResponseBody
    public HashMap<String, Object> signature(HttpServletRequest req){
        HashMap<String, Object> config = DingDing.getConfig(req);
        System.out.println("接口返回的json:"+JSON.toJSONString(config));
        return config;
    }

    //查询所有的点Code-----------有问题待解决
    @RequestMapping("/api/checkCode.do")
    @ResponseBody
    public HashMap<String, Object> findAllCodes()  {
        HashMap<String, Object> resMap = new HashMap<>();
        try {
            List<String> codeList = reportFormService.findAllPintCode();
            resMap.put("code","0");
            resMap.put("data",codeList);
            resMap.put("msg","请求成功");
        } catch (Exception e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }


    //测试的接口-2--------------------添加User
    @RequestMapping("/api/addUsers.do")
    @ResponseBody
    public  HashMap<String, Object> addUsers(HttpServletResponse res,HttpServletRequest req){
        HashMap<String, Object> resMap = new HashMap<>();
        try {
            String data = IOUtils.toString(req.getInputStream());
//            HashMap<String, Object> reqMap = new HashMap<>();
            System.out.println("传入的json参数:"+data);
            //json转换为map
            Map reqMap = JSON.parseObject(data, Map.class);
            System.out.println("json转换的map:"+reqMap.toString());
            //获取参数
            String name = reqMap.get("name").toString();
            String age = reqMap.get("age").toString();
            String school = reqMap.get("school").toString();
            User user = new User();
            user.setAge(Integer.parseInt(age));
            user.setName(name);
            user.setSchool(school);
            System.out.println(user.toString()+"<--------user");
            Boolean b = reportFormService.addUsers(user);
            if (b){
                resMap.put("data","添加用户成功");
            }else{
                resMap.put("data","添加用户失败");
            }
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (Exception e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }


    //测试的接口-1-----------------------------------无用
    @RequestMapping("/api/addPoints5.do")
    @ResponseBody
    public  HashMap<String, Object> addPoints2(HttpServletResponse res,HttpServletRequest req){
        HashMap<String, Object> resMap = new HashMap<>();
        try {
            Boolean b = reportFormService.addPoints2();
            if (b){
                resMap.put("data","添加点成功");
            }else{
                resMap.put("data","添加点失败");
            }
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (Exception e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }





    //中文乱码测试
    @RequestMapping("/api/test3.do")
    @ResponseBody
    public HashMap<String, Object> test3(HttpServletRequest req,HttpServletResponse res){
        HashMap<String, Object> resMap = new HashMap<>();
        try {
//            req.setCharacterEncoding("utf-8");
            String data = IOUtils.toString(req.getInputStream());
            Map map = JSON.parseObject(data, Map.class);
            String school = map.get("school").toString();
            String date = map.get("date").toString();
//            school = new String(school.getBytes("ISO-8859-1"), "UTF-8");
            System.out.println( req.getRequestURL()+"<----------URI");

//            school = new String(school.getBytes("ISO-8859-1"), "UTF-8");
//            date = new String(date.getBytes("ISO-8859-1"), "UTF-8");
            System.out.println(school+"<-------------school,学习,date------>"+date);
            //    -Dfile.encoding=UTF-8
//            res.setCharacterEncoding("UTF-8");
            */
/*
             * URIEncoding="UTF-8" useBodyEncodingForURI="true"
             *
             *
             *
             * *//*

//            res.setContentType("text/html;charset=UTF-8");
            resMap.put("data","学校");

        } catch (IOException e) {
            e.printStackTrace();
        }
        return resMap;
    }


    //测试<-------------报表展示数据--------部分测试
    @RequestMapping("/api/add2.do")
    @ResponseBody
    public  ArrayList<TagInfo> add2(HttpServletRequest req) {
        ArrayList<TagInfo> newList = new ArrayList<>();
        String tagCode="7_7CCSSIGSEL3OUT";
        SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat d2 = new SimpleDateFormat("yyyy-MM-dd");
        String date = d2.format(new Date());
        SimpleDateFormat d3 = new SimpleDateFormat("HH");
        int anInt = Integer.parseInt(d3.format(new Date()));
        if(anInt<18){
            System.out.println(anInt+"<--------anInt");
            String date10=date+" 16:00:00";
            Integer id_8=0;//14-16点
            String date9=date+" 14:00:00";
            Integer id_7=0;//12-14点
            String date8=date+" 12:00:00";
            Integer id_6=0;//10-12点
            String date7=date+" 10:00:00";
            Integer id_5=0;//8-10点
            String date6=date+" 08:00:00";
            Integer id_4=0;//6-8点
            String date5=date+" 06:00:00";
            Integer id_3=0;//4-6点
            String date4=date+" 04:00:00";
            Integer id_2=0;//2-4点
            String date3=date+" 02:00:00";
            Integer id_1=0;//0-2点
            String date2=date+" 00:00:00";
            //System.out.println(date9+"date9date9date9date9date9date9---"+date8);
            long time10=0;
            long time9=0;
            long time8=0;
            long time7=0;
            long time6=0;
            long time5=0;
            long time4=0;
            long time3=0;
            long time2=0;
            try {
                time9 = getTime(date9);
                time8 = getTime(date8);
                time7 = getTime(date7);
                time6 = getTime(date6);
                time5 = getTime(date5);
                time4 = getTime(date4);
                time3 = getTime(date3);
                time2 = getTime(date2);
                time10 = getTime(date10);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            System.out.println(time10+"---------"+time9+"---------"+time8+"---------"+time7
                    +"---------"+time6+"---------"+time5+"---------"+time4+"---------"+time3
                    +"---------"+time2);
            //一个点一天的数据
            List<TagInfo> infos = reportFormService.showDataByDateAndPoint2(tagCode, date);
            ArrayList<Integer> idList = new ArrayList<>();
            System.out.println(infos.size());
            for (int i = 0; i <infos.size(); i++) {
                if(id_8!=0&&id_7!=0&&id_6!=0&&id_5!=0&&id_4!=0&&id_3!=0&&id_2!=0&&id_1!=0){
                    break;
                }
                TagInfo info1 = infos.get(i);
                long time=0;
                try {
                    time = getTime(info1.getColltime());
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                //0-2点
                if(time<time3&&time>=time2){
                    if (id_1!=0){
                        continue;
                    }
                    //System.out.println("11111111111111111111"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_1=info1.getId();
                    System.out.println(id_1+"<--------0---2点 id");

                }
                //2-4点
                if(time<time4&&time>=time3){
                    if (id_2!=0){
                        continue;
                    }
                    //System.out.println("222222222222222"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_2=info1.getId();
                    System.out.println(id_2+"<--------2---4点 id");
                }
                //4-6点
                if(time<time5&&time>=time4){
                    if (id_3!=0){
                        continue;
                    }
                    //System.out.println("333333333333333333333"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_3=info1.getId();
                    System.out.println(id_3+"<--------4---6点 id");
                }
                //6-8点
                if(time<time6&&time>=time5){
                    if (id_4!=0){
                        continue;
                    }
                    //System.out.println("4444444444444444"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_4=info1.getId();
                    System.out.println(id_4+"<--------6---8点 id");
                }
                //8-10点
                if(time<time7&&time>=time6){
                    if (id_5!=0){
                        continue;
                    }
                    //System.out.println("5555555555555"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_5=info1.getId();
                    System.out.println(id_5+"<--------8---10点 id");
                }
                //10-12点
                if(time<time8&&time>=time7){
                    if (id_6!=0){
                        continue;
                    }
                    //System.out.println("66666666666666"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_6=info1.getId();
                    System.out.println(id_6+"<--------10---12点 id");
                }
                //12-14点
                if(time<time9&&time>=time8){
                    if (id_7!=0){
                        continue;
                    }
                    //System.out.println("77777777777777"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_7=info1.getId();
                    System.out.println(id_7+"<--------12---14点 id");
                }
                //14-16点
                if(time<time10&&time>=time9){
                    if (id_8!=0){
                        continue;
                    }
                    //System.out.println("88888888888888888888888"+i);
                    //System.out.println(info1.toString()+"-----------"+i);
                    idList.add(info1.getId());
                    id_8=info1.getId();
                    System.out.println(id_8+"<--------14---16点 id");
                }
            }
            System.out.println(JSON.toJSONString(idList)+"<------------idList");
            TagInfo tag2 = reportFormService.selectByPrimaryKey(id_1);
            newList.add(tag2);
            TagInfo tag3 = reportFormService.selectByPrimaryKey(id_2);
            newList.add(tag3);
            TagInfo tag4 = reportFormService.selectByPrimaryKey(id_3);
            newList.add(tag4);
            TagInfo tag5 = reportFormService.selectByPrimaryKey(id_4);
            newList.add(tag5);
            TagInfo tag6 = reportFormService.selectByPrimaryKey(id_5);
            newList.add(tag6);
            TagInfo tag7 = reportFormService.selectByPrimaryKey(id_6);
            newList.add(tag7);
            TagInfo tag8 = reportFormService.selectByPrimaryKey(id_7);
            newList.add(tag8);
            TagInfo tag9 = reportFormService.selectByPrimaryKey(id_8);
            newList.add(tag9);
            //最新的点的一个最新数据
            TagInfo info2 = reportFormService.showDataByDateAndPoint(tagCode, date);
            System.out.println(info2.toString()+"最新的点的一个最新数据");
            newList.add(info2);
            System.out.println(JSON.toJSONString(newList)+"<------------newList");
        }
        return newList;
    }


    //添加测试的点数据------------taginfo
    @RequestMapping("/api/add.do")
    @ResponseBody
    public void add(HttpServletRequest req) {
        SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("url------>"+req.getRequestURL());
        TagInfo info = new TagInfo();
        info.setStatus("");
        info.setTagname2("总水量");
        info.setTagname("7_7CCSSIGSEL3OUT");
        info.setDatetime("2018-08-08");
        info.setColltime(d.format(new Date()));
        info.setComment(1);
        info.setTagvalue("343.2233");
        boolean b = reportFormService.addData(info);
        System.out.println(b+",b_b_b_b_b_b_b_b_b_");

    }


    //更新
    @RequestMapping("/api/up.do")
    @ResponseBody
    public int update(){
        List<PointInfo> list = dao.findAllPointsInfo();
        System.out.println("修改开始!!!!!");
        for (int i = 0; i < list.size(); i++) {
            PointInfo info = list.get(i);
            info.setKind1("实时");
            info.setComment(0);
            String name = info.getPointname();
            if(name.contains("8")){
                info.setKind2("环保指标(8)");
            }else if (name.contains("7")){
                info.setKind2("环保指标(7)");
            }
            int up = dao.up(info);
            System.out.println(up+"-----"+i+"-----"+info.getId());
        }

        System.out.println("修改完成!!!!!");


        return 0;
    }




    //备用接口
    //展示报表数据--------------实时数据类----------pi数据库
    @RequestMapping("/api/showDataPre.do")
    @ResponseBody
    public HashMap<String, Object> showReportData(HttpServletRequest req,HttpServletResponse res){
        System.out.println(req.getRequestURL()+"<--------showReportData------url");
        HashMap<String, Object> resMap = new HashMap<>();
        SimpleDateFormat d1 = new SimpleDateFormat("yyyy-MM-dd");
        String format = d1.format(new Date());
        try {
            String data = IOUtils.toString(req.getInputStream());
            JSONObject jsonObject = JSON.parseObject(data);
            //获取参数
            //展示的点的列表
            JSONArray jsonArray = jsonObject.getJSONArray("codeList");
            //点所属的分类
           String kind1 = jsonObject.get("kind1").toString();//<---------小的分类
            String kind2 = jsonObject.get("kind2").toString();//<-----------大的分类
            //如果没有传递选择的点,则系统---------没有自动设置默认显示的点

            //日期
            String date = jsonObject.get("date").toString();
            if (date==null || date.equals("")){
                date=format;
            }
            System.out.println(date+"<--------展示数据的日期");
            String startime = jsonObject.get("startime").toString();
            String endtime = jsonObject.get("endtime").toString();
            System.out.println(startime+"<---startime---endtime---->"+endtime);
            long time1=0;
            long time2=0;
            try {
                time1 = getTime(startime);
                time2 = getTime(endtime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            List<Object> list = new ArrayList<>();
            if (jsonArray.size()>0){
                for (int i = 0; i <jsonArray.size() ; i++) {
                    String code = jsonArray.get(i).toString();
                    List<TagInfo> infoList = reportFormService.showDataByDateAndPoint2(code, date);
                    List<TagInfo> arr = new ArrayList<>();
                    for (int j = 0; j <infoList.size() ; j++) {
                        TagInfo info = infoList.get(i);
                        long time=0;
                        try {
                            time = getTime(info.getColltime());
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                        if(time>=time1&&time<=time2){
                            arr.add(info);
                        }
                    }
                    list.add(i,arr);
                    list.add(infoList);
                }
            }
            resMap.put("data",list);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (IOException e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        System.out.println("接口返回的json:"+JSON.toJSONString(resMap));
        return resMap;
    }



*/


/*

    //曲线展示页面的筛选功能
    @RequestMapping("/api/getTagListByKind.do")
    @ResponseBody
    public HashMap<String, Object> getTagListByKind(HttpServletRequest req){
        System.out.println(req.getRequestURL());
        HashMap<String, Object> resMap = new HashMap<>();
        SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd");
        String date = d.format(new Date());
        try {
            String data = IOUtils.toString(req.getInputStream());
            JSONObject jsonObject = JSON.parseObject(data);
            String kind1 = jsonObject.get("kind1").toString();
            String kind2 = jsonObject.get("kind2").toString();
            System.out.println(kind1+"<----kind1----kind2--->"+kind2);
            List<PointInfo> list = reportFormService.checkPointInfoByKind2(kind2);
            List<String> list2 = new ArrayList<>();
            for (PointInfo t:list) {
                int count = reportFormService.checkCount(t.getPointcode(), date);
                if (count>0){
                    list2.add(t.getPointname());
                }
            }
            System.out.println(JSON.toJSONString(list2)+"<----返回的数据列表");
            resMap.put("data",list2);
            resMap.put("code","0");
            resMap.put("msg","请求成功");
        } catch (IOException e) {
            resMap.put("data","");
            resMap.put("code","1");
            resMap.put("msg","请求失败,系统异常");
            e.printStackTrace();
        }
        return resMap;
    }


*/

}
